package com.chengh.vhr.service.serviceImpl;

import com.chengh.vhr.mapper.MenuRoleMapper;
import com.chengh.vhr.service.MenuRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class MenuRoleServiceImpl implements MenuRoleService {

    @Autowired
    MenuRoleMapper menuRoleMapper;

    @Transactional
    @Override
    public boolean updateMenuRole(Integer rid, List<Integer> mIds) {
        menuRoleMapper.deleteByRid(rid);
        if(mIds == null || mIds.size() == 0) {
            return true;
        }
        Integer i = menuRoleMapper.insertRecord(rid,mIds);
        return i == mIds.size();
    }
}
